home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / alv.sun / alv.lha / src / palettetool.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-08  |  2.7 KB  |  94 lines

  1. /************************************ palette_main.c ********/
  2.  
  3. /* Palettetool.c, a color palette and code generation tool.
  4.  *
  5.  * Copyright (c) 1987, Sun Microsystems, Inc.
  6.  *
  7.  * Note:  this code is completely unsupported.
  8.  *
  9.  * Change Notes: (7/1/87, by hsc%vanderbilt@csnet-relay)
  10.  *        1) a colormap stripe is added to reflect the
  11.  *           spectrum change while modifying the single
  12.  *           entry;
  13.  *        2) colormap file generated is formatted to
  14.  *           our local specs.
  15.  *
  16.  */
  17. #include "p_include.h"
  18. #include "p_icons.h"
  19.  
  20. #ifdef STANDALONE
  21. ain(argc, argv, envp)
  22. #else
  23. alettetool_main(argc, argv, envp)
  24. #endif
  25. nt    argc;
  26. har    **argv;
  27. {
  28.     progname = strsave(*argv);
  29.     palette_init();
  30.  
  31.     base_frame = window_create(NULL, FRAME,
  32.             FRAME_ICON, &palette_icon,
  33.         FRAME_LABEL, "palettetool",
  34.             FRAME_ARGS, argc, argv,
  35.             0);
  36.  
  37.     control_panel = window_create(base_frame, PANEL,
  38.             WIN_WIDTH, 560,
  39.             0);
  40.  
  41.     panel_creation();
  42.  
  43.     display_canvas = window_create(base_frame, CANVAS,
  44.             WIN_X, 0,
  45.             WIN_BELOW, control_panel,
  46.             CANVAS_AUTO_SHRINK, FALSE,
  47.             WIN_HEIGHT, 3*MAX_CMAP_LEN-(int)window_get(control_panel, WIN_HEIGHT)-11*(xspace+cwidth)+2*xoff,
  48.             WIN_WIDTH, (int) window_get(control_panel, WIN_WIDTH),
  49.             WIN_VERTICAL_SCROLLBAR, scrollbar_create(0),
  50.             WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0),
  51.             WIN_EVENT_PROC, display_event_proc,
  52.             WIN_CONSUME_PICK_EVENTS, MS_LEFT, MS_MIDDLE, MS_RIGHT, 0,
  53.             0);
  54.     multiple_canvas = window_create(base_frame, CANVAS,
  55.             WIN_X, 0,
  56.             WIN_BELOW, display_canvas,
  57.            WIN_WIDTH, (int)window_get(control_panel, WIN_WIDTH), /*24*(xspace+cwidth)+2*xoff,*/
  58.           WIN_HEIGHT, 11*(yspace+cheight)+2*yoff,
  59.                 CANVAS_AUTO_SHRINK, FALSE,
  60.             WIN_EVENT_PROC, multiple_canvas_event_proc,
  61.             0);
  62.  
  63.           brush_cursor = cursor_create(CURSOR_IMAGE, &brushpix,
  64.                       CURSOR_XHOT, 8, CURSOR_YHOT, 7,
  65.                       CURSOR_OP, PIX_SRC|PIX_DST,
  66.                       0);
  67.  
  68.     window_set(multiple_canvas, WIN_CURSOR, brush_cursor, 0);
  69.  
  70.     single_canvas = window_create(base_frame, CANVAS,
  71.             WIN_RIGHT_OF, control_panel,
  72.             WIN_Y, 0,
  73.             WIN_WIDTH, 100,
  74.             WIN_HEIGHT,  (int)window_get(display_canvas, WIN_HEIGHT) + (int) window_get(multiple_canvas, WIN_HEIGHT)+(int)window_get(control_panel,WIN_HEIGHT)+10, /*3*MAX_CMAP_LEN,*/
  75.                 CANVAS_AUTO_SHRINK, FALSE,
  76.             WIN_EVENT_PROC, single_canvas_event_proc,
  77.         WIN_CONSUME_PICK_EVENTS, MS_LEFT, MS_MIDDLE, MS_RIGHT, 0,
  78.         CANVAS_REPAINT_PROC, paint_single_canvas,
  79.             0);
  80.  
  81.     put_colors(0, MAX_CMAP_LEN, r, g, b);
  82.      paint_multiple_canvas();
  83.     paint_single_canvas();
  84.  
  85.     panel_set_value(red_slider, r[selected_n]);
  86.     panel_set_value(green_slider, g[selected_n]);
  87.     panel_set_value(blue_slider, b[selected_n]);
  88.  
  89.     window_fit(base_frame);
  90.  
  91.     window_main_loop(base_frame);
  92.  
  93. }
  94.